package com.letfox.ad.controller.ad;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.letfox.ad.controller.BaseController;
import com.letfox.ad.service.ADAppSynthesizeService;

@Controller
@RequestMapping(value = "/ad_report")
public class ADAppRepController extends BaseController{
	
	@Autowired
	private ADAppSynthesizeService adAppSynthesizeService;
	
	/**
	 * 曝光上报
	 * @param request_id
	 * @param view_id
	 * @return
	 */
	@RequestMapping(value = "/imp",method=RequestMethod.GET)
	@ResponseBody
	public String impressReport(String request_id,String view_id){
		String returnJson=null;
		try {
			returnJson=adAppSynthesizeService.impressCheck(request_id, view_id);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			returnJson="{\"ret\":\"200000\",\"msg\":\"\"}";
		}
		return returnJson;
	}
	
	/**
	 * 点击上报
	 * @param request_id
	 * @param view_id
	 * @param clk_coord
	 * @return
	 */
	@RequestMapping(value = "/click",method=RequestMethod.GET)
	@ResponseBody
	public String clickReport(String request_id,String view_id,String inter,String plan,String clk_coord){
		String returnJson=null;
		try {
			returnJson=adAppSynthesizeService.clickCheck(request_id, view_id,inter,plan,clk_coord,response);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			returnJson="{\"ret\":\"200000\",\"msg\":\"\"}";
		}
		return returnJson;
	}
	
	/**
	 * 转化上报
	 * @param request_id
	 * @param view_id
	 * @param click_id
	 * @return
	 */
	@RequestMapping(value = "/conver",method=RequestMethod.GET)
	@ResponseBody
	public String converReport(String request_id,String view_id,String click_id,String action_id){
		String returnJson=null;
		try {
			returnJson=adAppSynthesizeService.converCheck(request_id, view_id, click_id, action_id);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			returnJson="{\"ret\":\"200000\",\"msg\":\"\"}";
		}
		return returnJson;
	}
	
}
